package com.web.controller;


import com.web.entity.CalorieOption;
import com.web.entity.HealthOption;
import com.web.entity.Result;
import com.web.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
@CrossOrigin
public class ReportController {
    @Autowired
    private ReportService personHealthInfoService;

    //http://localhost:8080/report/chartData?userId=2

    @GetMapping("/chartData")
    public Result getChartData(@RequestParam Integer userId) {
        HealthOption chartData = this.personHealthInfoService.getChartData(userId);
        return Result.success(chartData);
    }

    //http://localhost:8080/report/calorieChart?userId=2

    @GetMapping("/calorieChart")
    public Result getCalorieChart(@RequestParam Integer userId) {
        CalorieOption calorieChart = this.personHealthInfoService.getCalorieChart(userId);
        return Result.success(calorieChart);
    }

}
